<meta charset="utf-8">
 <title>中华健身俱乐部</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<link rel="stylesheet" type="text/css" href="/static/new_ui/new_css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/static/new_ui/new_css/base_v3.0.css">
<link rel="stylesheet" type="text/css" href="/static/new_ui/new_css/themes.css">
<link rel="stylesheet" type="text/css" href="/static/new_ui/new_css/colpick.css">
<link href="http://ui.fcstatic.naryou.cn/static/libs/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<link  style="width:16px; height=16px;" rel="shortcut icon" href="/static/new_ui/images/logo_s.png">
<script type="text/javascript" src="/static/new_ui/new_js/jquery.js"></script>
<script type="text/javascript" src="/static/libs/easyui/jquery.easyui.min.js"></script>
<!-- <script type="text/javascript" src="/static/new_ui/new_js/base_v3.0.js"></script> -->
<script type="text/javascript" src="/static/new_ui/new_js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/new_ui/new_js/build.js"></script>
<script type="text/javascript" src="/static/new_ui/new_js/css3-mediaqueries.js"></script>
<script type="text/javascript" src="/static/new_ui/new_js/themes.plugin.js"></script>
<link rel="stylesheet" type="text/css" href="/static/new_ui/new_css/datepicker.css">
<script type="text/javascript" src="/static/new_ui/new_js/datepicker.js"></script>
<script type="text/javascript" src="/static/new_ui/new_js/pagelation.js"></script>
<script type="text/javascript" src="/static/new_ui/new_js/zepto.touchwipe.min.js"></script>
<script type="text/javascript" src="/static/new_ui/new_js/colpick.js"></script>
<script type="text/javascript">
    $.extend({  //jquery extend
        turnOnAjax: function (flag, str) {
            var html = "<div class='modal-backdrop fade in' id='ajaxloadimg' style='z-index:20000'><center><img src='/static/new_ui/img/ajaxloadimg.gif' style='margin: auto;width: 50px;margin-top: 20%;'><p style='color: white;font-weight: bold;'>" + str + "</p></center></div>"
            if (flag == 'on') {
                $("body").append(html)
            } else {
                $("#ajaxloadimg").remove();
            }
        },
    });
</script>
<style type="text/css">
    .paging-box a:link {
        color: gray;
    }

    .paging-box a:hover {
        color: green;
        text-decoration: none;
    }

    #A_key_distribution .left-group ul .current {
        border-left-color: #fff;
        background-color: #fff;
    }

    .check-box1 {
        display: inline-block;
        width: 16px;
        height: 16px;
        border: 1px solid #99a3a4;
        border-radius: 2px;
        vertical-align: middle;
    }

    .selected1 {
        background-color: #16ab4f;
        border: 1px solid #16ab4f;
    }

    .selected1 i {
        display: inline-block;
        width: 16px;
        height: 16px;
        background: url("/static/new_ui/images/selected.png") center center no-repeat;
        background-size: 11px 8px;
    }

    .disabled1 {
        border: 1px solid #cacfd2;
        background-color: #f0f0f0;
    }

    .disabled1 + span {
        color: #7c8d8d;
    }

    .check-box1 + span {
        vertical-align: middle;
    }

    .check-box1 + span:hover {
        cursor: pointer
    }

    .container-fluid.tops {
        padding-bottom: 0px;
    }

    .optionPage {
        display: block;
        float: left;
        margin-left: 200px;
    }

    .prev, .next {
        display: inline-block;
        padding: 15px;
        font-size: 18px;
    }

    .pageNum {
        display: inline-block;
        padding: 15px;
        font-size: 16px
    }
</style>
<input type="hidden" name="numcount" id="numcount" value="0">
<div class="container-fluid warp tops">
    <h1 class="page-headers no-icon no-border">
        全部客户
    </h1>

    <div class="row-fluid">
        <div id="myCustom" class="tab-content single-content" style="margin-top: -7px;">
            <div class="tab-pane fade in active" id="zhucekehu" style="min-width:1240px;">
                <div class="right-btn">
                    <a class="button btn-success btn-w80 btn-h30" href="#addCustomer" onclick="clearMyData()"
                       data-toggle="modal">添加客户</a>

                </div>
                <table class="table">
                    <tr>
                        <th>姓名</th>
                        <th>手机号</th>
                        <th>来源</th>
                        <th>
                            <a class="sort" href="javascript:void(0);" onclick="orderBy('99')">注册时间
                                <span></span>
                            </a>
                        </th>
                        <th>顾问</th>
                        <th>老学员手机号</th>
                        <th>操作</th>
                    </tr>
                    <% newdata.forEach(function(data, index){ %>
                    <tr>
                        <td>
                            <a class="pass color-green" href="/cus/detail/<%= data._id %>" target="_blank">
                                <span class="name color-green"><%= data.remarkName %></span>
                            </a>
                        </td>
                        <td>
                            <span class="phone-num"><%= data.mobile %></span>
                        </td>
                        <td><span><%= data.type %></span></td>
                        <td><span><%= data.time %></span></td>
                        <td>
                            <span class="name"><%= data.consultantId %></span>
                        </td>
                        <td>
                            <span class="phone-num"><%= data.shareMobile %></span>
                        </td>
                        <td><a href="/removeOne/<%= data._id %>">删除</a></td>
                    </tr>
                    <% }) %>

                </table>
            </div>

        </div>
    </div>
</div>
<!-- 分页 -->
<% if (!(isFirstPage && isLastPage)){ %>
<div class="optionPage">
    <% if (!isFirstPage) { %>
    <a class="prev btn" href="?page=<%= page - 1 %>">上一页</a>
    <% } else { %>
    <a class="prev btn" href="javascript:;" disabled="disabled">上一页</a>
    <% } %>
    <% for(var i = 0, len = Math.ceil(total / 10); i < len; i++){ %>
    <!-- <option value="<%= i + 1 %>"><%= i + 1 %></option> -->
    <a class="pageNum" href="/cus/all/?page=<%= i + 1 %>" style="display:inline-block"><%= i + 1 %></a>
    <% } %>
    <% if (!isLastPage) { %>
    <a class="next btn" href="?page=<%= page + 1 %>">下一页</a>
    <% } else { %>
    <a class="next btn" href="javascript:;" disabled="disabled">上一页</a>
    <% } %>
</div>
<% } %>

<!---------弹出层---->

<!--一键分配所有无置业顾问的客户弹出层-->
<div id="A_key_distribution" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h3 class="PopupTitle">分配置业顾问</h3>
    </div>
    <div class="modal-body clearFix akkey">
        <div>
            <span class="akey_Prompt"><strong>提示 :</strong><span> 将0个无置业顾问归属的客户平均分配给选中的置业顾问。</span></span>
        </div>
        <div class="a_key_search">
            <span class="check-box1 selected1 all"><i></i></span>&nbsp;&nbsp;
            <span class="check-box1-name" title="全部" style="margin-left:-6px">全部</span>

        </div>
        <div class="left-group pull-left left_right">
            <ul>

                <li class="current">
                    <span class="check-box1 selected1 Sales_group"><i></i></span>&nbsp;&nbsp;
                    <span class="check-box1-name">销售一组</span>
                </li>

            </ul>
        </div>
        <div class="right-name pull-right left_right">

            <ul class="current">


                <li>
                                            <span class="check-box1 selected1"><input type="hidden"
                                                                                      name="consultantid"
                                                                                      value="4642"><i></i></span>&nbsp;&nbsp;
                    <span class="check-box1-name check-box1-akkey" title="维尼">维尼</span>
                </li>


                <li>
                                            <span class="check-box1 selected1"><input type="hidden"
                                                                                      name="consultantid"
                                                                                      value="4638"><i></i></span>&nbsp;&nbsp;
                    <span class="check-box1-name check-box1-akkey" title="王圣学">王圣学</span>
                </li>


                <li>
                                            <span class="check-box1 selected1"><input type="hidden"
                                                                                      name="consultantid"
                                                                                      value="4417"><i></i></span>&nbsp;&nbsp;
                    <span class="check-box1-name check-box1-akkey" title="梁宁">梁宁</span>
                </li>


                <li>
                                            <span class="check-box1 selected1"><input type="hidden"
                                                                                      name="consultantid"
                                                                                      value="4194"><i></i></span>&nbsp;&nbsp;
                    <span class="check-box1-name check-box1-akkey" title="梁先森">梁先森</span>
                </li>


                <li>
                                            <span class="check-box1 selected1"><input type="hidden"
                                                                                      name="consultantid"
                                                                                      value="2948"><i></i></span>&nbsp;&nbsp;
                    <span class="check-box1-name check-box1-akkey" title="段琳钰">段琳钰</span>
                </li>


            </ul>

        </div>
    </div>
    <form id="distributionForm">
        <input type="hidden" name="type" value="all">
        <input type="hidden" name="consultantids" id="consultantids">
    </form>
    <div class="modal-footer">
        <button class="button btn-success btn-w100" onclick="submitONEKey(this)">确定</button>
        <button class="button btn-gray btn-w100" data-dismiss="modal" aria-hidden="true">取消</button>
    </div>
</div>
<!-----分配置业顾问-->
<div id="distribute" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h3 class="PopupTitle">分配置业顾问</h3>
    </div>
    <div class="modal-body clearFix">
        <div class="left-group pull-left">
            <ul>

                <li class="current">销售一组</li>

            </ul>
        </div>
        <div class="right-name pull-right">


            <ul class="current">


                <li onclick="$('#consid').val(4642);">维尼</li>


                <li onclick="$('#consid').val(4638);">王圣学</li>


                <li onclick="$('#consid').val(4417);">梁宁</li>

                <li onclick="$('#consid').val(4194);">梁先森</li>

                <li onclick="$('#consid').val(2948);">段琳钰</li>

            </ul>

        </div>
    </div>
    <div class="modal-footer">
        <input type="hidden" name="memid" id="memid">
        <input type="hidden" name="consid" id="consid">
        <button class="button btn-success btn-w100" onclick="bindConsultant(this);">确定</button>
        <button class="button btn-gray btn-w100" data-dismiss="modal" aria-hidden="true">取消</button>
    </div>
</div>
</div>
</div>
<script>
    $(document).ready(function () {

        $(".datepicker").remove();
        $('#beginDate').DatePicker({
            format: 'Y-m-d',
            date: new Date().toLocaleDateString(),
            current: $('#beginDate').val(),
            starts: 1,
            position: 'bottom',
            onBeforeShow: function () {
                $('#beginDate').DatePickerSetDate(new Date().toLocaleDateString(), true);
            },
            onChange: function (formated, dates) {
                $('#beginDate').val(formated);
                $('#beginDate').DatePickerHide();
                $('#beginDate').focus();
            }
        });
        $('#endDate').DatePicker({
            format: 'Y-m-d',
            date: new Date().toLocaleDateString(),
            current: $('#endDate').val(),
            starts: 1,
            position: 'bottom',
            onBeforeShow: function () {
                $('#endDate').DatePickerSetDate(new Date().toLocaleDateString(), true);
            },
            onChange: function (formated, dates) {
                $('#endDate').val(formated);
                $('#endDate').DatePickerHide();
                $('#endDate').focus();
            }
        });
    });
    //导出数据
    function exportData() {
        var form = document.getElementById('form1');
        form.action = "/merse/customerManage/all/info/exportData";
        searchCustomerInfo();
        form.action = "/merse/customerManage/all/info";
    }
    function searchCustomerInfo() {
        document.getElementById('currentPage').value = 1;
        var beginDate = document.getElementById('beginDate').value;
        var endDate = document.getElementById('endDate').value;
        if (beginDate != null) {
            document.getElementById('startDynamicDate').value = beginDate;
        }
        if (endDate != null) {
            document.getElementById('endDynamicDate').value = endDate;
        }
        document.getElementById('form1').submit();

    }
    //点击字段排序
    function orderBy(param) {
        document.getElementById('currentPage').value = 1;
        var orderBy = document.getElementById('orderBy').value;
        document.getElementById('orderBy').value = param;
        var desc_or_asc = document.getElementById('desc_or_asc').value;
        if (param != orderBy) {

            document.getElementById('desc_or_asc').value = "DESC";
        } else {
            if (desc_or_asc == "DESC") {
                document.getElementById('desc_or_asc').value = "ASC";
            }
            if (desc_or_asc == "" || desc_or_asc == "ASC") {
                document.getElementById('desc_or_asc').value = "DESC";
            }
        }
        document.getElementById('form1').submit();
    }
    //绑定键盘按下事件
    $(document).keypress(function (e) {
        // 回车键事件
        if (e.which == 13) {
            document.getElementById('form1').submit();
        }
    });
    function clearMyData() {
        $("#addCustomer").find(".in-text2").val("");
        var date = new Date().format('yyyy-MM-dd');
        $("#visitDate").val(date);
    }
    $(function () {
        var $ulObj = $(".right-name ul");
        $(".left-group ul li").each(function (i) {
            $(this).live('click', function () {
                $ulObj.removeClass('current').eq(i).addClass('current');
                $(".left-group ul li").removeClass('current');
                $(this).addClass('current');
            });
        });
        $(".right-name ul li").live('click', function () {
            $(".right-name ul li").removeClass('current');
            $(this).addClass('current');
        });
    });
    //绑定置业顾问
    function bindConsultant(obj) {
        var memberid = document.getElementById('memid').value;
        var consultantid = document.getElementById('consid').value;
        $.ajax({
            url: "/merse/customerManage/bindConsultant/" + memberid + "/" + consultantid,
            type: "POST",
            data: {memo: "全部客户初始分配"},
            cache: false,
            success: function (data) {
                saveResult(data.success ? 1 : 0, data.msg);
                document.getElementById('form1').submit();
            }
        });
    }
    $(function () {
        var $ulObj = $(".right-name ul");
        $(".left-group ul li").each(function (i) {
            $(this).live('click', function () {
                $ulObj.removeClass('current').eq(i).addClass('current');
                $(".left-group ul li").removeClass('current');
                $(this).addClass('current');
            });
        });
        $(".right-name ul li").live('click', function () {
            $(".right-name ul li").removeClass('current');
            $(this).addClass('current');
        });
    });
    $(function () {
        var $ulObj1 = $("#A_key_distribution .right-name ul");
        var $rightli = $("#A_key_distribution .pull-right ul li");
        var $leftli = $("#A_key_distribution .pull-left ul li");
        var $left_ch = $leftli.find(".Sales_group");
        var $sellength = $leftli.find(".selected1").length;
        var $lilength = $leftli.length;
        $("#A_key_distribution .left-group ul li").each(function (i) {
            $(this).live('click', function () {
                $("#A_key_distribution .left-group ul li").removeClass('current');
                $(this).addClass('current');
                $ulObj1.removeClass('current').eq(i).addClass('current');
                console.log($ulObj1.removeClass('current').eq(i).addClass('current'));
                checkselected1($(this).find(".check-box1"));
                if ($(this).find(".check-box1").hasClass("selected1")) {
                    $ulObj1.eq(i).find(".check-box1").addClass("selected1");
                } else {
                    $ulObj1.eq(i).find(".check-box1").removeClass("selected1");
                }
                //        左边点击cheackbox
                var $sellength = $leftli.find(".selected1").length;
                var $lilength = $leftli.length;
                if ($sellength == $lilength) {
                    $(".all").addClass('selected1');
                }
                else {
                    $(".all").removeClass("selected1");
                }
            });
        });
        //  点击全选
        $(".all").click(function () {
            checkselected1(this);
            $(this).hasClass("selected1") ? $leftli.find(".check-box1").addClass("selected1") : $leftli.find(".check-box1").removeClass("selected1");
            $(this).hasClass("selected1") ? $rightli.find(".check-box1").addClass("selected1") : $rightli.find(".check-box1").removeClass("selected1");
        });
        //  点击右边cheackbox
        $rightli.live('click', function () {
            checkselected1($(this).find(".check-box1"));
            var $rightli_length = $(this).parent(".current").find("li").length;
            var $rightselect_length = $(this).parent(".current").find("li").find(".selected1").length;
            console.log($rightli_length + '   ' + $rightselect_length);
            if ($rightli_length == $rightselect_length) {
                $(this).parents(".right-name").prev(".left-group").find(".current").find(".check-box1").addClass("selected1");
                var $sellength = $leftli.find(".selected1").length;
                var $lilength = $leftli.length;
                if ($sellength == $lilength) {
                    $(".all").addClass('selected1');
                } else {
                    $(".all").removeClass("selected1");
                }
            } else {
                $(this).parents(".right-name").prev(".left-group").find(".current").find(".check-box1").removeClass("selected1");
                $(".all").removeClass("selected1");
            }
        })
    });
    function checkselected1(obj) {
        var _this = $(obj).hasClass("check-box1") ? $(obj) : $(obj).prev(".check-box1");
        _this.hasClass('selected1') ? _this.removeClass('selected1') : _this.addClass('selected1');
    }
    function addValue() {
        var arr = "";
        $("#A_key_distribution").find(".right-name ul li").each(function () {
            if ($(this).find(".check-box1").hasClass("selected1")) {
                arr += $(this).find(".check-box1").find("input[name='consultantid']").val() + "-";
            }
        })
        $("#A_key_distribution").find("#distributionForm").find("#consultantids").val(arr);
    }

    function submitONEKey(obj) {
        addValue();
        var consultant = $("#A_key_distribution").find("#distributionForm").find("#consultantids").val();
        if ($.trim(consultant) == '' || consultant == null) {
            saveResult(0, "请选择置业顾问");
            return;
        }
        $.turnOnAjax('on', '操作中，请耐心等待........');
        var $modal = $(obj).parent().parent();
        $modal.removeClass("in").css("display", "none");
        $.ajax({
            url: '/merse/customerManage/batch',
            data: {consultantids: consultant, type: "all", memo: "全部客户一键分配"},
            type: "POST",
            timeout: 240000,
            dataType: 'json',
            success: function (data) {
                statusInfo($(obj), 1, data);
                $.turnOnAjax('off', '');
                window.location.href = "/merse/customerManage/all/info";
            },
            complete: function (XMLHttpRequest, status) { //请求完成后最终执行参数
                $.turnOnAjax('off', '');
                window.location.href = "/merse/customerManage/all/info";
            }
        });
    }
    function noConsultant() {
        saveResult(0, "当前列表没有无置业顾问归属的客户");
        return;
    }
</script>
<!--添加客户弹出层-->
<script type="text/javascript" src="/static/new_ui/js/jsDialog.js"></script>
<script type="text/javascript" src="/static/libs/easyui/jquery.easyui.validator.js"></script>
<!--添加客户弹出层-->
<form id="add_form" action="/custom" method="post">
    <div id="addCustomer" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h3 class="PopupTitle">添加客户</h3>
        </div>
        <div class="modal-body add-customer">
            <h3 style="margin-top:10px">新客户资料</h3>

            <div class="input-cont2">
                <p>
                    <span class="clip-popup-font w85 color-0">手机号: </span>
                    <input type="text" onfocus="hideTips('tips1')" id="mobile" onblur="checkMobile(this.value)"
                           name="mobile" class="in-text2 wrong h30 w220" maxlength="11"><span
                            class="value-wrong2 tips1"></span>
                </p>
            </div>
            <div class="input-cont2">
                <p>
                    <span class="clip-popup-font w85 color-0">备注名 : </span>
                    <input type="text" name="remarkName" id="remarkName" maxlength="10" class="in-text2 wrong h30 w220"
                           onfocus="hideTips('tips-remarkName')"><span class="value-wrong2 tips-remarkName"></span>
                </p>
            </div>
            <div class="input-cont2">
                <p>
                    <span class="clip-popup-font w85 color-0">密码: </span>
                    <input type="password" onfocus="hideTips('tips1')" id="pass" name="password"
                           class="in-text2 wrong h30 w220" maxlength="11"><span class="value-wrong2 tips1"></span>
                </p>
            </div>
            <!--单选按钮-->
            <div class=" input-cont2">
                <p class="radios-module">
                    <span class="clip-popup-font w85 color-0">来源类型 : </span>
                    <select class="in-text2 wrong h30 w220" name="type" style="height:30px;width:220px;">
                        <option value="小秘书">小秘书</option>
                        <option value="客带客">客带客</option>
                        <option value="客带客">微官网</option>
                        <option value="线下营销">线下营销</option>
                        <option value="其他">其他</option>
                    </select>
                </p>
            </div>
            <div class="input-cont2">
                <p class="add-call-time">
                    <span class="clip-popup-font w85 color-0"><span id="visitType">注册</span>时间 : </span>
                    <input type="text" name="time" class="w220 h30" id="visitDate" value=""><em class="Icon2"></em>
                </p>
            </div>
            <h3 class="add-customer-record">顾问</h3>
            <span class="add-customer-choice">(选填)</span>
            <div class="input-cont2">
                <div>

                    <span class="clip-popup-font w85 color-0">顾问 : </span>
                    <select class="in-text2 wrong h30 w220" name="consultantId" style="height:30px;width:220px;">
                        <option value="马璇">马璇</option>
                        <option value="孟帅">孟帅</option>
                        <option value="杨焱">杨焱</option>
                    </select>
                </div>
            </div>
            <h3 class="add-customer-record">记录客带客关系</h3>
            <span class="add-customer-choice">(必填)</span>

            <div class="input-cont2">
                <p>
                    <span class="clip-popup-font w85 color-0">老客户手机号：</span>
                    <input type="text" name="shareMobile" id="shareMobile" onfocus="hideTips('tips2')"
                           onblur="checkOldMobile(this.value)" class="in-text2 wrong h30 w220" maxlength="11"><span
                            class="value-wrong2 tips2"></span>
                </p>
            </div>
        </div>
        <div class="modal-footer">
            <button type="submit" class="button btn-success btn-w100 clip-save">确认添加</button>
            <button type="button" class="button btn-gray btn-w100" data-dismiss="modal" aria-hidden="true">取消</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="/static/libs/util.js"></script>
<script>
    //根据职业顾问销售组查找职业顾问
    function chooseConsultant(orgId) {
        $("#consultantId").val("");
        $("#defaultOne").html('<a href="javascript:void(0);" onclick="setConsultantId(\'\')">--无--</a>');
        $("#consultants").empty();
        if (orgId < 0) {
            $("#consultants").html('<li><a href="javascript:void(0);">--无--</a></li>');
            return;
        }
        var url = "/merse/appointment/member/consultant";
        $.ajax({
            url: url,
            type: 'get',
            data: $.param({orgId: orgId}, true),
            success: (function (data) {
                var consultants = data.consultantList;
                var html = '';
                for (var i in consultants) {
                    var consultant = consultants[i];
                    html += '<li><a href="javascript:void(0);" onclick="setConsultantId(' + consultant.id + ')">' + consultant.name + '</a></li>';
                }
                $("#consultants").html(html);
            })
        });
    }
    function setConsultantId(consultantId) {
        $("#consultantId").val(consultantId);
    }
    //验证手机号是否存在，该客户是否还可以被推荐到该楼盘
    function checkMobile(mobile) {
        var url = "/merse/appointment/member/checkMobile";
        if (!isMobel(mobile)) {
            $(".tips1").html("请输入有效手机号！").css('display', 'inline-block');
            return;
        }
        $.ajax({
            url: url,
            type: 'get',
            data: $.param({mobile: mobile}, true),
            success: (function (data) {
                if (data) {
                    $(".tips1").html("该手机号已存在，不能再被添加！").css('display', 'inline-block');
                }
            })
        });
    }
    function checkOldMobile(mobile) {
        var url = "/merse/appointment/member/checkOldMobile";
        if (mobile != "") {
            $.ajax({
                url: url,
                type: 'get',
                data: $.param({mobile: mobile}, true),
                success: (function (data) {
                    if (!data) {
                        $(".tips2").html("该老客未注册，请确认已注册！").css('display', 'inline-block');
                    }
                })
            });
        }
    }
    function hideTips(obj) {
        $("." + obj).html("").css('display', 'none');
    }
    function isMobel(value) {
        if (value.match(/^1[3|4|5|6|7|8]\d{9}$/)) {
            return true;
        } else {
            return false;
        }
    }
    $(function () {
        $(".radios-module .radios").on('click', function () {
            var r_value = $(this).attr('data-value');
            if (r_value == 1) {
                $("#visitType").html("来电");
            }
            if (r_value == 2) {
                $("#visitType").html("到访");
            }
            $(this).parents().find('.radio-value').val(r_value);
        });
    });
    function saveSubmit(obj) {
        if (!isMobel($("#mobile").val())) {
            saveResult(0, "请输入有效手机号！");
            return;
        }
        if ($("#shareMobile").val() != "") {
            if (!isMobel($("#shareMobile").val())) {
                saveResult(0, "老客户手机号无效！");
                return;
            }
        }
        if ($("#remarkName").val().length < 2) {
            saveResult(0, "请输入2-10位备注名！");
            return;
        }
        // var url = "/custom";
        // $.post(url, $('#add_form').serialize(), function (data) {
        // if (data.status == "SUCCESS") {
        // statusInfo($(obj),1,"保存成功");
        // document.getElementById('form1').submit();
        // } else {
        // saveResult(0);
        // }
        // }, "json");
        // }
        $(function () {
            $('#visitDate').DatePicker({
                format: 'Y-m-d',
                date: new Date().toLocaleDateString(),
                current: $('#visitDate').val(),
                starts: 1,
                position: 'bottom',
                onBeforeShow: function () {
                    $('#visitDate').DatePickerSetDate(new Date().toLocaleDateString(), true);
                },
                onChange: function (formated, dates) {
                    $('#visitDate').val(formated);
                    $('#visitDate').DatePickerHide();
                    $('#visitDate').focus();
                }
            });
        });
</script>